/* Copyright (C) 2008, 2009, 2010 Faindu GmbH, Switzerland.
* All Rights Reserved. The following is Source Code and is subject to all restrictions 
* on such code as contained in the license accompanying this project. */
package blocstac.editimage.base
{
	
	import blocstac.api.blocbox.ImageLoader;
	import blocstac.api.blocbox.MimeType;
	import blocstac.editimage.EditImageData;
	import blocstac.editimage.EditState;

public interface StateManager
{

	//--------------------------------------------------------------------------
	//
	//  ImageModel interaction
	//
	//--------------------------------------------------------------------------	

	function apply(op:ImageOperation):void
	
	function interactionStarts():Boolean
	
	function interactionEnds(op:ImageOperation):void

	/**
	 * Setting to false also clears the undo- and redo-history.
	 */
	function switchToEditState(editState:EditState):void

	function get editState():EditState
	
	//--------------------------------------------------------------------------
	//
	//  ViewModel interaction
	//
	//--------------------------------------------------------------------------	

	function updateUserViewScale(userViewScale:Number):void
	
	/**
	 * Defines the max width of the EditImage component when EditImage must be 
	 * smaller than the image width. 
	 */
	function maxComponentWidthInContainer(maxComponentWidth:Number):Number
	
	function applyPan(userPanX:Number, userPanY:Number):void
	
	function get viewModel():ViewModel
	
	//--------------------------------------------------------------------------
	//
	//  Export / Import
	//
	//--------------------------------------------------------------------------

	function importData(value:EditImageData, mimeType:MimeType):void
	
	function imageHasChanged():Boolean
		
	function export(imageLoader:ImageLoader):EditImageData
	
	//--------------------------------------------------------------------------
	//
	//  Undo / Redo
	//
	//--------------------------------------------------------------------------	
	function undo():Boolean

	/**
	 * Redo the next operation. If the user interaction such as cropping is just going on,
	 * redo does not apply the next operation and returns false. 
	 */
	function redo():Boolean
	
	function canUndo():Boolean
	
	/** 
	 * Returns true if an operation can be redone. 
	 */
	function canRedo():Boolean
	
}
}